<!DOCTYPE html>
<html lang="zh-CN" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>后台管理</title>
    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/css/bootstrap.min.css" rel="stylesheet">
</head>
<body>
<div class="container my-4">
    <h1 class="text-center">陶瓷信息管理</h1>
    <div class="my-3">
        <a th:href="@{/admin/new}" class="btn btn-primary">添加新陶瓷</a>
    </div>
    <div th:if="${message}" class="alert alert-success" th:text="${message}"></div>
    <table class="table table-striped">
        <thead>
        <tr>
            <th>ID</th>
            <th>名称</th>
            <th>描述</th>
            <th>历史</th>
            <th>图片URL</th>
            <th>操作</th>
        </tr>
        </thead>
        <tbody>
        <tr th:each="ceramic : ${ceramics}">
            <td th:text="${ceramic.id}"></td>
            <td th:text="${ceramic.name}"></td>
            <td th:text="${ceramic.description}"></td>
            <td th:text="${ceramic.history}"></td>
            <td th:text="${ceramic.imageUrl}"></td>
            <td>
                <a th:href="@{/admin/edit/{id}(id=${ceramic.id})}" class="btn btn-sm btn-warning">编辑</a>
                <a th:href="@{/admin/delete/{id}(id=${ceramic.id})}" class="btn btn-sm btn-danger" onclick="return confirm('确定删除？')">删除</a>
            </td>
        </tr>
        </tbody>
    </table>
</div>
</body>
</html>